﻿using System.Collections.Generic;
//
namespace PerceptiveMCAPI.Types
{
   public class listWebhookAddParms
   {
      public string apikey { get; set; }
      public string id { get; set; }
      public string url { get; set; }
      public Dictionary<EnumValues.listWebhookActions, bool> webhook_actions { get; set; }
      public Dictionary<EnumValues.listWebhookSources, bool> webhook_sources { get; set; }
      // --------------------------------------------------------------------

      public listWebhookAddParms ()
      {
         this.apikey = MCAPISettings.default_apikey;
         this.webhook_actions = initActions();
         this.webhook_sources = initSources();
      }

      public listWebhookAddParms ( string id, string url )
      {
         this.apikey = MCAPISettings.default_apikey;
         this.id = id;
         this.url = url;
         this.webhook_actions = initActions();
         this.webhook_sources = initSources();
      }

      public listWebhookAddParms ( string id, string url,
         Dictionary<EnumValues.listWebhookActions, bool> actions,
         Dictionary<EnumValues.listWebhookSources, bool> sources )
      {
         this.apikey = MCAPISettings.default_apikey;
         this.id = id;
         this.url = url;
         this.webhook_actions = actions;
         this.webhook_sources = sources;
      }

      public listWebhookAddParms ( string apikey, string id, string url )
      {
         this.apikey = apikey;
         this.id = id;
         this.url = url;
         this.webhook_actions = initActions();
         this.webhook_sources = initSources();
      }

      public listWebhookAddParms ( string apikey, string id, string url,
         Dictionary<EnumValues.listWebhookActions, bool> actions,
         Dictionary<EnumValues.listWebhookSources, bool> sources )
      {
         this.apikey = apikey;
         this.id = id;
         this.url = url;
         this.webhook_actions = actions;
         this.webhook_sources = sources;
      }
      // ------------------------------------------------------------------------
      private Dictionary<EnumValues.listWebhookActions, bool> initActions ()
      {
         Dictionary<EnumValues.listWebhookActions, bool> actions =
         new Dictionary<EnumValues.listWebhookActions, bool>();
         //
         actions.Add( EnumValues.listWebhookActions.subscribe, MCAPISettings.default_listWebhook_actions_subscribe );
         actions.Add( EnumValues.listWebhookActions.unsubscribe, MCAPISettings.default_listWebhook_actions_unsubscribe );
         actions.Add( EnumValues.listWebhookActions.profile, MCAPISettings.default_listWebhook_actions_profile );
         actions.Add( EnumValues.listWebhookActions.cleaned, MCAPISettings.default_listWebhook_actions_cleaned );
         actions.Add( EnumValues.listWebhookActions.upemail, MCAPISettings.default_listWebhook_actions_upemail );
         //
         return actions;
      }
      //
      private Dictionary<EnumValues.listWebhookSources, bool> initSources ()
      {
         Dictionary<EnumValues.listWebhookSources, bool> sources =
         new Dictionary<EnumValues.listWebhookSources, bool>();
         //
         sources.Add( EnumValues.listWebhookSources.user, MCAPISettings.default_listWebhook_sources_user );
         sources.Add( EnumValues.listWebhookSources.admin, MCAPISettings.default_listWebhook_sources_admin );
         sources.Add( EnumValues.listWebhookSources.api, MCAPISettings.default_listWebhook_sources_api );
         //
         return sources;
      }
   }
}
